﻿@namespace MudBlazor.Docs.Examples

@inject IDialogService DialogService


<MudButton @onclick="DeleteUser" Variant="Variant.Filled" Color="Color.Error">Delete Records</MudButton>
<MudButton @onclick="Confirm" Variant="Variant.Filled" Color="Color.Success">Remove Email</MudButton>
<MudButton @onclick="Download" Variant="Variant.Filled" Color="Color.Warning">Slow Computer</MudButton>

@code {

    private void DeleteUser()
    {
        var parameters = new DialogParameters();
        parameters.Add("ContentText", "Do you really want to delete these records? This process cannot be undone.");
        parameters.Add("ButtonText", "Delete");
        parameters.Add("Color", Color.Error);

        var options = new DialogOptions() { CloseButton = true, MaxWidth = MaxWidth.ExtraSmall };

        DialogService.Show<DialogTemplateExample_Dialog>("Delete", parameters, options);
    }

    private void Confirm()
    {
        var parameters = new DialogParameters();
        parameters.Add("ContentText", "Are you sure you want to remove thisguy@emailz.com from this account?");
        parameters.Add("ButtonText", "Yes");
        parameters.Add("Color", Color.Success);

        DialogService.Show<DialogTemplateExample_Dialog>("Confirm", parameters);
    }

    private void Download()
    {
        var parameters = new DialogParameters();
        parameters.Add("ContentText", "Your computer seems very slow, click the download button to download free RAM.");
        parameters.Add("ButtonText", "Download");
        parameters.Add("Color", Color.Info);

        DialogService.Show<DialogTemplateExample_Dialog>("Slow Computer Detected", parameters);
    }
}
